/**********************************************************************************************************
Author                Date                Version        Update
        
BibhuDutta Mishra                         1.0


************************************************************************************************************/


public class OORDuplicateAccChecklistCtrl{
     Public List<Account> AccList {get; set;}         
          public OORDuplicateAccChecklistctrl(ApexPages.StandardController controller) { 
                 
              Lead currentlead= (Lead)controller.getRecord();
              ID localAdvertiserRecordTypeID = RecordTypeHelper.GetRecordTypeID('Account', 'Local OOR Customer');
              AccList = [select id,name,phone,owner.name,AFrontier_CustomerID__c,Type__c,Account_Status__c,Primary_Contact__c,Primary_Phone__c,Primary_Owner__c,City__c,State__c,OOR_AccountCityState__c from Account where (OOR_AccountCityState__c =: currentlead.OOR_LeadCityState__c OR cleanphonetext__C =: currentlead.cleanphonetext__C) AND RecordTypeId=:localAdvertiserRecordTypeID   limit 10];
              
              if(AccList.size()>5){
              
                  Account acc = new Account();
                  
                  for(Account ac:AccList){
                  
                      if(ac.id == currentlead.DupingAccountID__c){
                        acc = ac;
                        break;
                        
                       }
                  }
                  
                  Acclist.clear();
                  AccList.add(acc);
                  
              }
          }
}